﻿using AntUITest.Models;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace AntUITest
{
    public class AppInfo
    {
        public static string m_strAppName = ""; // 程序名称
        public static string m_strCompany = ""; // 公司名称
        public static string m_strCopyright = ""; // 公司名称
        public static string m_strAppVer = ConfigurationManager.AppSettings["CurrentVersion"];  // 程序版本号
        public static Icon m_iconApp = null;    // 程序图标
        public static Boolean m_bDbConnected = false;  //数据库是否连接
        public static Boolean m_bIsWebserverDB = false;  // 是否WebService数据库

        public static bool m_bLogin;    // 是否通过系统登录验证
        public static UserInfo m_UserInfo = new UserInfo();    // 用户信息 


        static AppInfo()
        {
            // 取程序集相关信息
            Assembly asm = Assembly.GetExecutingAssembly();
            m_strAppName = ((AssemblyTitleAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyTitleAttribute))).Title.ToString();
            m_strCopyright = ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute))).Copyright.ToString();
            m_strCompany = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCompanyAttribute))).Company.ToString();
            //m_strAppVer = asm.GetName().Version.ToString();
            // 取图标信息
            m_iconApp = Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath);
        }
    }
}
